import { ref, markRaw } from 'vue'
import Toast from '../components/Toast.vue'

const toastComponent = ref(null)

export function useToast() {
  const setToastComponent = (component) => {
    toastComponent.value = markRaw(component)
  }

  const show = (message, type = 'success') => {
    if (toastComponent.value) {
      toastComponent.value.addToast(message, type)
    }
  }

  return {
    setToastComponent,
    show
  }
} 